<?php
namespace app\content\controller;
use think\admin\Controller;
use app\index\model\Banner as BannerModel;
use app\index\model\DataUser;
use app\model\Merchant as MerchantModel;
use app\model\MerchantCate;
use think\admin\helper\QueryHelper;

class Merchant  extends Controller{

     /**
     * @auth true
     * @menu true
     */
    public function index(){
        $search = input('get.');
        MerchantModel::mQuery()->with('cate')->layTable(function () {
            $this->title = '商家列表';
        }, function (QueryHelper $query) use ($search) {
            // 数据列表搜索过滤
            $query->like('cate_name');
        });
    }

     /**
     * @auth true
     * @menu true
     */
    public function edit()
    {
        $this->title = '编辑';
        $this->cate_list = MerchantCate::select();
        // MyModel::mForm('form');
        $this->_form('merchant','form');
    }

     /**
     * @auth true
     * @menu true
     */
    public function add()
    {
        $this->title = '添加';
        $this->cate_list = MerchantCate::select();
        $this->_form('merchant','form');
    }

    public function remove()
    {
        $this->_delete('merchant');
    }


    public function state()
    {
     
        MerchantModel::mSave($this->_vali([
            'status.in:0,1'  => '状态值范围异常！',
            'status.require' => '状态值不能为空！',
        ]));
    }
}